<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Book extends Model
{
    use HasFactory,HasDatetimeFormatter;

    const STATUS_NORMAL = 1;
    const STATUS_DOWN = 0;

    const STATUS_ENUM = [
        '1' => '正常',
        '0' => '下架'
    ];


    public function category()
    {
        return $this->belongsTo(BookCategory::class);
    }


    public function bookSelf()
    {
        return $this->hasOne(BookSelf::class,'id','selves_id');
    }
}
